package buco.core.internal;

import java.io.File;
import java.io.IOException;
import java.util.jar.JarFile;

import buco.core.api.Bundle;

public class JARParser {
	
	public static Bundle parse(File jarFile) throws IOException { 
		JarFile jar = new JarFile(jarFile);
		Bundle bundle = new Bundle(); 
		ProcessJarContext ctx = new ProcessJarContext(bundle, jar); 
		FilterChain<ProcessJarContext> filterChain = new FilterChain<ProcessJarContext>();
		filterChain.addFilter(new ManifestFilter()); 
		filterChain.addFilter(new BclFilter()); 
		ctx = filterChain.executeChain(ctx);		
		return ctx.getBundle();
	}
}
